const crypto=require('crypto');
module.exports={
	//md5加密
	MD5_SUFFIX:'dsfiogiuohdfsfksdkhfaskdjfskdfksdfkjsd送到房间号东$$%^%@#$方国际',
	md5:function(str)
	{
		var obj=crypto.createHash('md5');
		obj.update(str);
		var str=obj.digest('hex');
		return str;
	},
	getTime:function()
	{
		var time=new Date();
		var year=time.getFullYear();
		var month=(time.getMonth()+1);
		var dates=time.getDate();
		
		var h=time.getHours();
		var m=time.getMinutes();
		var s=time.getSeconds();
		
		month=month<10?"0"+month:month;
		dates=dates<10?"0"+dates:dates;
		h=h<10?"0"+h:h;
		m=m<10?"0"+m:m;
		s=s<10?"0"+s:s;
		
		var timeStr=year+ "/" +month+"/"+dates+" "+h+":"+m+":"+s;
		
		return timeStr;
	},
	getdata:function()
    {
        var time=new Date();
        var year=time.getFullYear();
        var month=(time.getMonth()+1);
        var dates=time.getDate();

        var h=time.getHours();
        var m=time.getMinutes();
        var s=time.getSeconds();

        month=month<10?"0"+month:month;
        dates=dates<10?"0"+dates:dates;
        h=h<10?"0"+h:h;
        m=m<10?"0"+m:m;
        s=s<10?"0"+s:s;

        var timeStr=year+""+month+""+dates+""+h+""+m+""+s;

        return timeStr;
    },
    random:function () {
		//随机数
        var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];

        function generateMixed() {
            var res = "";
            for(var i = 0; i < 6 ; i ++) {
                var id = Math.ceil(Math.random()*35);
                res += chars[id];
            }
            return res;
        }
    }
};
